﻿<!DOCTYPE html>
<html>
	<head runat="server">
		<title>JS &amp; AJAX Training</title>
		<link href="/Styles/Site.css" rel="stylesheet" type="text/css" />
		<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
	</head>

	<body>
		<form runat="server" id="frmPage">
			<section class="page">
				<ul class="nav">
					<li><a href="JS.html">JavaScript beyond basics</a></li>
					<li><a href="jquery.html">basic jQuery</a></li>
					<li><a href="Ajax.html">AJAX</a></li>
				</ul>
				<header>
					<h1>JS &amp; AJAX</h1>
				</header>
				<section class="main">
					<h2>AJAX</h2>

					<h3>jQuery</h3>

					<h4><code>$.ajax(options)</code></h4>
					<p>This single method is all you need.</p>
					<p>Here's a list of the most common options:</p>
	
					<dl>
						<dt>url</dt>
						<dd>URL to call (thank you, Captain Obvious).</dd>

						<dt>type</dt>
						<dd>HTTP method to use, usually <code>GET</code> or <code>POST</code>.</dd>

						<dt>data</dt>
						<dd>Data to send with a request. This could be either a string or an object (which is serialized by jQuery to string using query string format)</dd>

						<dt>contentType</dt>
						<dd>MIME type of the transmitted data. Usually set to <code>application/json; charset=utf-8</code> for ASP.NET web services.</dd>

						<dt>success, error, complete</dt>
						<dd>Functions that are called after a successful response, error response and every response, respectively.</dd>
					</dl>

					<p>...and <a href="http://api.jquery.com/jQuery.ajax/">a lot more</a></p>

					<ul>
						<li>Default settings can be set by <code>$.ajaxSetup</code> function</li>
						<li>Several shortcut methods exist, such as <code>$.get</code>, <code>$.getJSON</code> or <code>load</code></li>
					</ul>

					<script src="/Scripts/ajax.js"></script>
				</section>
			</section>
		</form>
	</body>
</html>